Xbasic

Toolbar.controlEnable Method

Syntax

Current_State as L = <toolbar>.ControlEnable as L(index as N,flag as L)

Arguments

index

Index specifies which button on the toolbar that is set. An Index value of 1 specifies the first button on the toolbar.

flag

.T. = Enable the button, .F. = Disable the button

Description

Enables or disables a button on a toolbar.

Discussion

The <toolbar>.controlEnable() method sets that status of a button on a toolbar to either enabled or disabled. The toolbar is specified by the object pointer, <toolbar>.

If you want to control the state of buttons on system toolbars (i.e. toolbars that are opened automatically by a Form, Browse, Print Preview window), then you must first get a pointer to the system toolbar before you can use this method. Use the Toolbar::get() function to get a pointer to a toolbar whose name you know.

A toolbar's name can be determined by undocking the toolbar so that it is floating, and checking the title that appears in the toolbar title bar.

Example

dim tbar as P
tbar = toolbar::open("My Own Toolbar")
tbar.controlenable(3, .T.)

'The following disables the 3 rd control on the default toolbar in
'Form View
'-----------------------------------------------------------------
tbar = toolbar::get("Form View")
tbar.controlenable(3,.f.)

Limitations

Desktop applications only.

See Also